VERSION 5.00
Begin VB.Form FrmRegister 
   BackColor       =   &H00000000&
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   1935
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   2880
   LinkTopic       =   "Form1"
   ScaleHeight     =   1935
   ScaleWidth      =   2880
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.Timer tmrFollow 
      Enabled         =   0   'False
      Interval        =   1
      Left            =   4800
      Top             =   3960
   End
   Begin VB.CommandButton cmdYesBut 
      Caption         =   "Yeah Dude!  I love this program!"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1095
      Left            =   240
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   600
      Width           =   1695
   End
   Begin VB.CommandButton cmdNoBut 
      Caption         =   "no"
      BeginProperty Font 
         Name            =   "MS Serif"
         Size            =   6
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2280
      TabIndex        =   2
      Top             =   960
      Width           =   375
   End
   Begin VB.Image Up_LeftPic 
      Height          =   570
      Left            =   4440
      Picture         =   "FrmRegister.frx":0000
      Top             =   3840
      Visible         =   0   'False
      Width           =   555
   End
   Begin VB.Image LeftPic 
      Height          =   570
      Left            =   3900
      Picture         =   "FrmRegister.frx":0432
      Top             =   3840
      Visible         =   0   'False
      Width           =   555
   End
   Begin VB.Image Down_LeftPic 
      Height          =   570
      Left            =   3360
      Picture         =   "FrmRegister.frx":086D
      Top             =   3840
      Visible         =   0   'False
      Width           =   555
   End
   Begin VB.Image DownPic 
      Height          =   570
      Left            =   2820
      Picture         =   "FrmRegister.frx":0CA5
      Top             =   3840
      Visible         =   0   'False
      Width           =   555
   End
   Begin VB.Image Down_RightPic 
      Height          =   570
      Left            =   2280
      Picture         =   "FrmRegister.frx":10DD
      Top             =   3840
      Visible         =   0   'False
      Width           =   555
   End
   Begin VB.Image RightPic 
      Height          =   570
      Left            =   1740
      Picture         =   "FrmRegister.frx":150F
      Top             =   3840
      Visible         =   0   'False
      Width           =   555
   End
   Begin VB.Image Up_RightPic 
      Height          =   570
      Left            =   1200
      Picture         =   "FrmRegister.frx":194A
      Top             =   3840
      Visible         =   0   'False
      Width           =   555
   End
   Begin VB.Image UpPic 
      Height          =   570
      Left            =   660
      Picture         =   "FrmRegister.frx":1D82
      Top             =   3840
      Visible         =   0   'False
      Width           =   555
   End
   Begin VB.Image FacePic 
      Height          =   570
      Left            =   120
      Picture         =   "FrmRegister.frx":21B7
      Top             =   3840
      Visible         =   0   'False
      Width           =   555
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "Would you like to Register me?"
      ForeColor       =   &H00FFFFFF&
      Height          =   255
      Left            =   480
      TabIndex        =   0
      Top             =   120
      Width           =   2295
   End
End
Attribute VB_Name = "FrmRegister"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
    'Get the current cursor Hot-Spot position

Private Type POINTAPI
        X As Long
        Y As Long
End Type

Const a_Radius = 30 'Acceptable Radius the cursor can be
                'within for the button to 'grab' the cursor
Const HWND_TOPMOST = -1
Dim XnY As POINTAPI, ExitDo As Boolean

Private Sub cmdNoBut_Click()
    cmdYesBut.ZOrder 0  'Set the follower button to infront
    cmdYesBut.Font.Size = 8
    cmdYesBut.Caption = "Grrrr!" & Chr(13) & Chr(10) & "Register now!!"
    cmdYesBut.Picture = FacePic.Picture
    tmrFollow.Enabled = True  'Start the button moving!
End Sub

Private Sub cmdYesBut_Click()
    ExitDo = True
    tmrFollow.Enabled = False
    MsgBox "Oh Thanks, Have a Nice day", vbOKOnly, "????"

    Unload Me
End Sub

Private Sub DirectionPic(ByVal LeftRight As Integer, UpDown As Integer)
    If UpDown = 0 Then
        If LeftRight = 1 Then
            cmdYesBut.Picture = LeftPic.Picture
        Else
            cmdYesBut.Picture = RightPic.Picture
        End If
    ElseIf UpDown = 1 Then
        If LeftRight = 0 Then
            cmdYesBut.Picture = UpPic.Picture
        ElseIf LeftRight = 1 Then
            cmdYesBut.Picture = Up_LeftPic.Picture
        Else
            cmdYesBut.Picture = Up_RightPic.Picture
        End If
    Else
        If LeftRight = 0 Then
            cmdYesBut.Picture = DownPic.Picture
        ElseIf LeftRight = 1 Then
            cmdYesBut.Picture = Down_LeftPic.Picture
        Else
            cmdYesBut.Picture = Down_RightPic.Picture
        End If
    End If
End Sub


Private Sub tmrFollow_Timer()
    Dim Direction As Integer
    
    DoEvents
    GetCursorPos XnY
    XnY.X = ScaleX(XnY.X, vbPixels, vbTwips) 'Change the dimensions from Pixels
    XnY.Y = ScaleY(XnY.Y, vbPixels, vbTwips) 'to Twips

    If (cmdYesBut.Left + cmdYesBut.Width / 2 + Me.Left > XnY.X + a_Radius) Or (cmdYesBut.Left + cmdYesBut.Width / 2 + Me.Left < XnY.X - a_Radius) Then
        'Movement in X
        If cmdYesBut.Left < 0 Then
            cmdYesBut.Left = 0
            Me.Left = Me.Left - 15  'push window
            Direction = 1 'left
        ElseIf cmdYesBut.Left + cmdYesBut.Width > Me.Width Then
            cmdYesBut.Left = Me.Width - cmdYesBut.Width
            Me.Left = Me.Left + 15  'push window
            Direction = 2 'right
        Else
            If cmdYesBut.Left + cmdYesBut.Width / 2 + Me.Left < XnY.X Then
                cmdYesBut.Left = cmdYesBut.Left + 30
                Direction = 2
            Else
                cmdYesBut.Left = cmdYesBut.Left - 30
                Direction = 1
            End If
        End If
    End If
        
    If Not (cmdYesBut.Top + cmdYesBut.Height / 2 + Me.Top > XnY.Y - a_Radius) Or (cmdYesBut.Top + cmdYesBut.Height / 2 + Me.Top > XnY.Y + a_Radius) Then
        If cmdYesBut.Top < 0 Then
            cmdYesBut.Top = 0
            Me.Top = Me.Top - 15
            Call DirectionPic(Direction, 1)
        ElseIf cmdYesBut.Top + cmdYesBut.Height > Me.Height Then
            cmdYesBut.Top = Me.Height - cmdYesBut.Height
            Me.Top = Me.Top + 15
            Call DirectionPic(Direction, 2)
        Else
            If cmdYesBut.Top + cmdYesBut.Height / 2 + Me.Top < XnY.Y Then
                cmdYesBut.Top = cmdYesBut.Top + 30
                Call DirectionPic(Direction, 2)
            Else
                cmdYesBut.Top = cmdYesBut.Top - 30
                Call DirectionPic(Direction, 1)
            End If
        End If
    ElseIf Direction = 0 Then
        'Within a_Radius twips of the center
        '(pretty long IF statements huh?!)
        tmrFollow.Enabled = False
        Call StickButton(Me, cmdYesBut, cmdYesBut.Width / 2, cmdYesBut.Height / 2)
    Else: Call DirectionPic(Direction, 0)
    End If
End Sub

Private Sub StickButton(ByVal Form As Form, ByVal Button As CommandButton, DpX As Long, DpY As Long)
    Do
        DoEvents    'So it doesn't 'Hang' the program
        GetCursorPos XnY
        XnY.X = ScaleX(XnY.X, vbPixels, vbTwips)
        XnY.Y = ScaleY(XnY.Y, vbPixels, vbTwips)
        
        If XnY.X - DpX <= Form.Left Then
            Button.Left = 0
            Me.Left = Me.Left - 15
            If XnY.Y - DpY <= Form.Top Then
                Button.Top = 0
                Me.Top = Me.Top - 15
                Button.Picture = Up_LeftPic.Picture
            ElseIf XnY.Y + (Button.Height - DpY) >= Form.Top + Form.Height Then
                Button.Top = Form.Height - Button.Height
                Me.Top = Me.Top + 15
                Button.Picture = Down_LeftPic.Picture
            Else
                Button.Top = XnY.Y - DpY - Form.Top
                Button.Picture = LeftPic.Picture
            End If
        ElseIf XnY.X + Button.Width - DpX >= Form.Left + Form.Width Then
            Button.Left = Form.Width - Button.Width
            Me.Left = Me.Left + 15
            If XnY.Y - DpY <= Form.Top Then
                Button.Top = 0
                Me.Top = Me.Top - 15
                Button.Picture = Up_RightPic.Picture
            ElseIf XnY.Y + (Button.Height - DpY) >= Form.Top + Form.Height Then
                Button.Top = Form.Height - Button.Height
                Me.Top = Me.Top + 15
                Button.Picture = Down_RightPic.Picture
            Else
                Button.Top = XnY.Y - DpY - Form.Top
                Button.Picture = RightPic.Picture
            End If
        Else
            Button.Left = XnY.X - DpX - Form.Left
            If XnY.Y - DpY <= Form.Top Then
                Button.Top = 0
                Me.Top = Me.Top - 15
                Button.Picture = UpPic.Picture
            ElseIf XnY.Y + (Button.Height - DpY) >= Form.Top + Form.Height Then
                Button.Top = Form.Height - Button.Height
                Me.Top = Me.Top + 15
                Button.Picture = DownPic.Picture
            Else
                Button.Top = XnY.Y - DpY - Form.Top
                Button.Picture = FacePic.Picture
            End If
        End If
        If ExitDo Then Exit Do
    Loop
End Sub
